<template>
	<view class="container">
		<view class="response bg-white padding-lr solid-top">
			<view class="response solid-bottom flex flex-start padding-tb" v-for="item in list" :key="item.id" @click="toGoods(item.goods.id)">
				<view class="goods-image">
					<image :src="host + item.goods.goodsImg" mode="aspectFill"></image>
				</view>
				<view class="goods-msg flex flex-start flex-direction padding-left-sm">
					<view class="response text-content text-bold text-cut">{{item.goods.goodsName}}</view>
					<view class="text-price text-red">{{item.goods.price}}</view>
					<view class="text-sm text-gray margin-top-sm">{{item.goods.createdTime}}</view>
				</view>
			</view>
		</view>
		<view class="response text-center text-sm text-gray padding">没有更多了</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				host: ''
			}
		},
		onLoad() {
			var that = this;
			this.host = this.$host;
			that.$network.request("CollectionAction/getMyCollection", {}, function(res) {
				that.list = res.data.list;
				console.log(that.list)
			}, "", function(res) {
				console.error(JSON.stringify(res))
				uni.showToast({
					icon: 'none',
					title: '加载失败',
					duration: 1200
				})
			});
		},
		methods: {
			/* 查看商品信息 */
			toGoods(item) {
				uni.navigateTo({
					url:'/pages/product/product?id='+item+'&type=0'
				})
			}
		}
	}
</script>

<style>
	.goods-image {
		width: 120upx;
		height: 120upx;
	}

	.goods-image image {
		width: 100%;
		height: 100%;
	}

	.goods-msg {
		width: calc(100% - 120upx);

	}
</style>
